The present invention relates to an image data compression apparatus for compressing image data and an image data compression method for compressing the image data. More particularly, the present invention relates to an image data compression apparatus and an image data compression method suitable for once expanding compressed image data compressed through the JPEG (Joint Photographic coding Experts Group) method including quantization and adjusting quantization levels, and compressing the data again.
To compress and code static-image data, a method referred to as JPEG (Joint Photographic coding Experts Group) is widely used. To compress a still image through the JPEG method, image data for one page is divided into, for example, pixel blocks respectively including 8xc3x978 (64) pixels and compression is performed every pixel block. Each pixel block is discrete-cosine-transformed (DCT) into 8xc3x978 DCT coefficients (frequency space image data).
The 8xc3x978 DCT coefficients are divided by 8xc3x978 quantization levels respectively corresponding to each of the DCT coefficients and quantized. A set of 8xc3x978 quantization levels used for the quantization is also referred to as a quantization table. That is, when expressing each of 8xc3x978 DCT coefficients as D(i,j) and each of the 8xc3x978 quantization levels as Q(i,j), each DCT coefficient D(i,j) is divided by quantization level Q(i,j) corresponding to DCT coefficient D(i,j) in 8xc3x978 quantization levels included in the quantization table and the quotient is output as quantized data. Thus, the quantized data obtained as a result of DCT and quantization is further coded through the run length limited coding and output as compressed image data together with a quantization table used for compression.
To expand and decode the compressed image data compressed and coded through the JPEG method, it is necessary to perform inversion of compression and coding. That is, it is possible to obtain original static-image data by decoding compressed image data through the run length limited method to generate quantization data, multiplying the quantized data by a quantization level corresponding to each quantized data value to generate a DCT coefficient, moreover applying inverse discrete cosine transform (IDCT) to these DCT coefficients, and thereby expanding and decoding the compressed image data.
As the software for compressing and expanding an image through the JPEG method, there is, for example, libjpeg whose source program is opened to the public by IJG (Independent JPEG Group). The libjpeg prepares two types of standard quantization tables, and adjusts quantization level values included in the quantization tables in accordance with the designation of image quality by a user when compressing and coding a still image so that compressed image data having an image quality desired by the user can be obtained.
However, in case of the conventional software for compressing and expanding an image such as the libjpeg, it is only possible to designate an image quality or compression ratio but it is impossible for a user to adjust quantization levels (quantization table). Therefore, a user cannot know quantization level values (quantization table) for obtaining the image quality and compression ratio designated by the user.
For example, in the case expanding the compressed image data according to the JPEG method using photo-retouching software and compressing, coding, and recording the data by changing compression ratios again, a user may erroneously set the compression ratio to wastefully and greatly increase the amount of the compressed image data.
In the case of the JPEG method, however, because some of image information is lost after compression and coding, even if compressed image data once compressed and coded at a predetermined compression ratio is expanded and decoded, and compressed and coded again at a compression ratio lower than the case of the first compression and coding, the image quality of the compressed image data is not improved though the amount of data increases. In this case, it is preferable to show a user the quantization level values used for compressing and coding compressed image data so that the user can directly adjust not a compression ratio but quantization level values (quantization table) only in the direction in which the amount of data decreases and prevent the amount of the compressed image data from wastefully increasing.
As described above, however, there are nxc3x97n (e.g. 64) quantization levels included in one quantization table. Therefore, even if showing a user all the quantization levels, the user is only disturbed but it is difficult to support the adjustment of quantization levels (quantization table) by the user. Therefore, it is preferable to obtain a single value for indexing many quantization levels included in a quantization table to show it to a user so that the user can adjust the quantization levels (quantization table) by changing the index values. Previously described methods for controlling values of quantization levels (quantization table) used to compress image data are not suitable for a user to adjust quantization levels.
An object of the present is to provide an image data compression apparatus and an image data compression method capable of knowing the content of a quantization table used to obtain an image quality and a compression ratio designated to compress and code image data.
It is another object of the present invention to provide an image data compression apparatus and an image data compression method allowing a user to easily adjust a quantization table and thereby to compress image data without wastefully increasing the amount of data.
It is still another object of the present invention to provide an image data compression apparatus and an image data compression method allowing a user to easily adjust quantization levels by changing displayed index values because of being able to obtain and display a single value for indexing many quantization levels included in a quantization table.
To attain the above objects, image data compression method, apparatus, and computer products of the present invention use an image data compression method and/or apparatus for compressing image data through a predetermined compression method to generate compressed image data, in which the compression method at least performs compression by using a combination of a plurality of quantization levels (quantization table) and thereby performing quantization. The compressed image data and the quantization table used to generate the compressed image data are correlated to each other. In an example embodiment, the apparatus comprises: image data decompression means for expanding first compressed image data generated through the compression method to generate expanded image data; quantization index value generation means for generating quantization index values for indexing values of the quantization levels included in a first quantization table correlated to the expanded first compressed image data; quantization index value change means for changing the generated quantization index values, quantization table generation means for setting values of the quantization levels included in the quantization table in accordance with the changed quantization index values to generate a second quantization table; and image data compression means for compressing the generated expanded image data through the compression method by using the generated second quantization table to generate second compressed image data.
It is preferable that the compression method applies predetermined conversion to the image data of every pixel block which includes a plurality of pixels, and compresses coefficients obtained as a result of the conversion by using quantization levels included in the quantization table and corresponding to the coefficients and thereby quantizing the coefficients. The image data decompression means has de-quantization means for inversely quantizing the pixel blocks included in the first compressed image data by using the first quantization table and inverse conversion means for applying conversion opposite to the predetermined conversion to the inversely-quantized pixel blocks to generate the expanded image data. The quantization index value change means changes the generated quantization index values in accordance with external operations. The image data compression means has conversion means for applying the predetermined conversion to the pixel blocks included in the generated expanded image data and quantization means for quantizing the converted pixel blocks by using the generated second quantization table to generate the second compressed image data.
It is preferable that the compression method applies discrete cosine transform (DCT) to the image data of every pixel block including nxc3x97n pixels and compresses nxc3x97n DCT coefficients obtained as a result of the DCT, by using nxc3x97n quantization levels included in the quantization table and corresponding to the DCT coefficients and thereby quantizing the DCT coefficients. In the image data decompression means, the de-quantization means inversely quantizes nxc3x97n quantized DCT coefficients of each of the pixel blocks included in the first compressed image data by using nxc3x97n quantization levels included in the first quantization table corresponding to the DCT coefficients. The inverse conversion means applies inverse discrete cosine transform (IDCT) to the nxc3x97n DCT coefficients of each of the inversely-quantized pixel blocks to use nxc3x97n IDCT coefficients obtained as a result of the IDCT as the expanded image data, and in the image data compression means. The conversion means applies DCT to nxc3x97n IDCT coefficients of each of the pixel blocks included in the generated expanded image data. The quantization means quantizes the nxc3x97n DCT coefficients of each of the discrete-cosine-transformed pixel blocks by using quantization levels included in the second quantization table and corresponding to the DCT coefficients to use the nxc3x97n quantized DCT coefficients as the second compressed image data.
It is preferable that the quantization index value generation means generates the single quantization index value reflecting values of the quantization levels included in the first quantization table, the quantization index value change means changes the generated single quantization index value in accordance with external operations, and the quantization table generation means generates the second quantization table including the quantization levels respectively reflecting the changed single quantization index value.
It is preferable that the quantization index value generation means weights logarithmic values of the quantization levels included in the first quantization table and calculates a value by accumulating the weighted logarithmic values to use the value as the quantization index value, and the quantization table generation means generates the second quantization table by changing the quantization levels included in a prepared standard quantization table or the first quantization table so that a value obtained by weighting and accumulating the logarithmic values of the quantization levels included in the standard quantization table or the first quantization table similarly to the case of calculating the quantization index value becomes equal to the changed quantization index value.
It is preferable that the quantization index value change means displays the generated quantization index value and changes the quantization index value in accordance with external operations for the displayed quantization index value.